<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>登录页面</title>
	<script type="text/javascript" src="check_data.js"></script>
</head>
<body>
<h1>用户登录页面</h1><hr /><br />
<form name="send" method="post" action="register.php" onsubmit="return check();>
	<span>*</span><label form="">用户名：</label><input type="text" id="username" /><br />
	<span>*</span><label form="">密码：</label><input type="password" id="password" /><br />
	<input type="submit" value="登录" /><input type="reset" value="重写" />
</form>


<script>
function check(){
//验证表单
	if($("username").value == ""){
		alert("请输入用户名");
		return false;
	}
	if($("username").value.length <2 ){
		alert("用户名的长度必须大于2");
		return false;
	}
	if($("password").value == ""){
		alert("请输入密码");
		return false;
	}
	if($("cpassword").value.length < 6){
		alert("密码必须大于6位");
		return false;
	}
	if($("cpassword").value != $("cpassword").value){
		alert("两次输入的密码不一样");
		return false;
	}
	if($("email").value == ""){
		alert("请输入Email");
		return false;
	}
	if($("email").value.indexOf("@") == -1){
		alert("请输入正确的Email");
		return false;
	}
	return true;
}
function $(id){
	return document.getElementById(id);
}

</script>

</body>
</html>

